package gen.tools.query;

import gen.tools.Widgets;
import gen.tools.structures.S2;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;

public class QuerySourceSVN extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    public QuerySourceSVN() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		final Widgets wid = new Widgets();
		request.setCharacterEncoding( wid.UIcodeSet );
		response.setCharacterEncoding( wid.UIcodeSet );
		response.setContentType("application/json");
		
		final String subsysId= request.getParameter("subsysId");
		final String modId = request.getParameter("modId");
		
		final S2 s2 = wid.querySourceSVN(subsysId, modId);
		
		response.getWriter().write( new Gson().toJson(s2) );
	}

}
